package com.hxzy.service.impl;

import com.hxzy.entity.UmsMemberTag;
import com.hxzy.mapper.UmsMemberTagMapper;
import com.hxzy.service.UmsMemberTagService;
import com.hxzy.util.MybatisUtil;
import org.apache.ibatis.session.SqlSession;

public class UmsMemberTagServiceImpl implements UmsMemberTagService {
    @Override
    public UmsMemberTag selectByPrimaryKey(Long id) {
        UmsMemberTag umsMemberTag=null;
        try (SqlSession session= MybatisUtil.getSqlSessionFactory().openSession()){
            UmsMemberTagMapper mapper = session.getMapper(UmsMemberTagMapper.class);
           umsMemberTag = mapper.selectByPrimaryKey(id);
        }
        return umsMemberTag;
    }

    @Override
    public boolean insert(UmsMemberTag record) {
        int count=0;
        try (SqlSession session= MybatisUtil.getSqlSessionFactory().openSession()){
            UmsMemberTagMapper mapper = session.getMapper(UmsMemberTagMapper.class);
            count = mapper.insert(record);
        }
        return count>0;
    }

    @Override
    public boolean updateByPrimaryKey(UmsMemberTag record) {
        int count=0;
        try (SqlSession session= MybatisUtil.getSqlSessionFactory().openSession()){
            UmsMemberTagMapper mapper = session.getMapper(UmsMemberTagMapper.class);
            count = mapper.updateByPrimaryKey(record);
        }
        return count>0;
    }
}
